1 //-------------------------------------------------------------------------------------------------
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //-------------------------------------------------------------------------------------------------
11 class IIterator
: public virtual IConstIterator
<T
>
24 class Iterator
: public virtual IIterator
<T
>
31 explicit Iterator(RefCountedPtr
<IIterator
<T
> > spIterator
)
32 : m_spIterator(spIterator
)
40 m_spIterator
.Attach(new (zeromemory
) U(it
));
48 return m_spIterator
->MoveNext();
52 // NULL is used to represent an empty iterator
60 ThrowIfFalse2(m_spIterator
, "Current called on an empty iterator");
61 return m_spIterator
->Current();
67 ThrowIfFalse2(m_spIterator
, "Remove called on an empty iterator");
68 m_spIterator
->Remove();
72 // Allow default copy constructor and assignment operators to
73 // be generated because RefCountedPtr is copy safe
74 RefCountedPtr
<IIterator
<T
> > m_spIterator
;